
<template>
  <div>123123
    <el-input v-model="address" @input="parseAddress" placeholder="粘贴地址" />
    <div v-if="parsedAddress">
      <h3>解析结果：</h3>
      <p>{{ parsedAddress }}</p>
    </div>
  </div>
</template>
 
<script setup lang="ts">
import { ref } from 'vue';
import addressParser from 'addressparser';

const address = ref('');
const parsedAddress = ref(null);
const parseAddress =()=> {
      if (address.value) {
          const parsed = addressParser(address.value);
        console.log('parsed ===>',parsed);
        
        parsedAddress.value = parsed.map(part => `${part.name} <${part.address}>`).join(', ');
      } else {
        parsedAddress.value = null;
      }
    }
</script>
<style scoped>
input {
  width: 1500px;
  height: 600px;
  background-color: red;
  padding: 10px;
  margin-bottom: 10px;
}
</style>